enum logLevel {
    /** 调试级别，trace函数路径 **/
    trace = 0,
    /** 普通日志级别 **/
    log = 1,
    /** 信息日志级别 **/
    info = 2,
    /** 警告日志级别 **/
    warn = 3,
    /** 错误日志级别 **/
    error = 4,
}


export class Console {
    /**
    * @param tagStr 没有标签时默认显示的
    * @param color 日志颜色
    * @param arr 日志参数
    */
    private __log(tagStr, color, arr) {
        let tag = arr[0];
        if (typeof (tag) == "string" || tag == null || tag == undefined) {
            arr[0] = `%c ${arr[0]}`;
            arr.splice(1, 0, `color:${color}`);
        } else {
            arr.splice(0, 0, `%c ${tagStr} : `);
            arr.splice(1, 0, `color:${color}`);
        }
        console.log.apply(console, arr);
    }

    private _logLevel: number = null

    private static _instace: Console

    public static instace() {
        if (this._instace == null) {
            this._instace = new Console
        }

        return this._instace
    }


    public err(...agrs): void {
        console.log(arguments.length)
        let arr = Array.prototype.slice.call(arguments);
        this.__log("E", 'red', arr);
    }
}